package mju.cn.eightweek.controller;

import mju.cn.eightweek.controller.service.RoleService;
import mju.cn.eightweek.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * @program: java-ee_31
 * @description:
 * @author: HP
 * @time: 2020/10/28 22:31
 */
@Controller
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService =null;
    @RequestMapping(value = "/getRole",method = RequestMethod.GET)
    public ModelAndView getRole(@RequestParam("id") Long id){
        Role role = roleService.getRole(id);
        ModelAndView mv = new ModelAndView();
        mv.setViewName("roleDetails");
        mv.addObject("role",role);
        return mv;
    }
}
